package com.max.xihu.patterns.proxy.dynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author: Max
 * @Date: 2020-09-13 15:09
 * @Description:
 */
public class UserProxyHandler implements InvocationHandler {

    private Object object;

    public UserProxyHandler(Object object){
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("调用方法之前");

        method.invoke(this.object,args);//关键的一句代码

        System.out.println("调用方法之后");
        return null;
    }
}
